home *** CD-ROM | disk | FTP | other *** search
- Path: abcfd20.larc.nasa.gov!amiga-request
- From: amiga-request@abcfd20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
- Subject: v90i266: tinytools - misc shell enhancing tools, Part01/01
- Reply-To: W. Jaffe <aips@rulcvx.uucp>
- Newsgroups: comp.sources.amiga
- Message-ID: <comp.sources.amiga:v90i266@abcfd20.larc.nasa.gov>
- Date: 08 Oct 90 21:45:14 GMT
- Approved: tadguy@uunet.UU.NET (Tad Guy)
- X-Mail-Submissions-To: amiga@uunet.uu.net
- X-Post-Discussions-To: comp.sys.amiga
-
- Submitted-by: W. Jaffe <aips@rulcvx.uucp>
- Posting-number: Volume 90, Issue 266
- Archive-name: util/tinytools/part01
-
- [ uuencoded executables enclosed ...tad ]
-
- This archive contains a collection of shell enhancing tools (I've called
- them TinyTools) including assembly source.
-
- Here's a list;
-
- CheckList - Check for the presence of an item in a system list.
- Clip - Pipe through clipped lines.
- FilTex - Filter out non-text bytes.
- NoReq - Disable system requesters (toggle).
- PForm - Pipe through formatted lines.
- Tee - Split pipe stream.
- WBTF - WorkBench to front.
-
-
- #!/bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 1)."
- # Contents: CheckList CheckList/CheckList.asm CheckList/CheckList.man
- # CheckList/CheckList.uu Clip Clip/Clip.asm Clip/Clip.man
- # Clip/Clip.uu ExecMe FilTex FilTex/FilTex.asm FilTex/FilTex.man
- # FilTex/FilTex.uu Include Include/init.i NoReq NoReq/NoReq.asm
- # NoReq/NoReq.man NoReq/NoReq.uu PForm PForm/PForm.asm
- # PForm/PForm.man PForm/PForm.uu ReadMe Tee Tee/Tee.asm Tee/Tee.man
- # Tee/Tee.uu WBTF WBTF/WBTF.asm WBTF/WBTF.man WBTF/WBTF.uu
- # Wrapped by tadguy@abcfd20 on Mon Oct 8 17:45:11 1990
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test ! -d 'CheckList' ; then
- echo shar: Creating directory \"'CheckList'\"
- mkdir 'CheckList'
- fi
- if test -f 'CheckList/CheckList.asm' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'CheckList/CheckList.asm'\"
- else
- echo shar: Extracting \"'CheckList/CheckList.asm'\" \(1657 characters\)
- sed "s/^X//" >'CheckList/CheckList.asm' <<'END_OF_FILE'
- X; Clip input lines on specified locations and write result to standard output.
- X
- X INCLUDE "/include/init.i"
- X
- X; OPT D+
- X
- X; Variable storage
- X
- X STRUCT ArgArray,(3+1)*4
- X SIZE
- X
- X; Regs
- X
- XErrorStrPtr EQUR A4
- X
- X; Startup
- X
- X STACK 4000
- X INIT
- X
- X; Let ARP interpret the commandline
- X
- X MOVE.L ComLineBase(GP),A0
- X MOVE.L ComLineSize(GP),D0
- X LEA HelpMsg(PC),A1
- X LEA ArgArray(GP),A2
- X LEA Template(PC),A3
- X MOVE.L A1,(A2)
- X CALL GADS
- X MOVE.L (A2),ErrorStrPtr
- X TST.L D0
- X BEQ ErrorExit
- X BMI ErrorExit
- X
- X; Fail if no list specifier present
- X
- X LEA NoListSpec(PC),ErrorStrPtr
- X TST.L ArgArray+1*4(GP)
- X BNE.S ListSpecified
- X TST.L ArgArray+2*4(GP)
- X BEQ.S ErrorExit
- XListSpecified:
- X
- X; Cache A6, load execbase, forbid and presume success.
- X
- X MOVE.L A6,-(SP)
- X MOVE.L $4.W,A6
- X CALL Forbid
- X MOVE.W #5,ReturnCode(GP)
- X
- X; Search the task list
- X
- X TST.L ArgArray+1*4(GP)
- X BEQ.S NotTheTaskList
- X MOVE.L ArgArray(GP),A1
- X CALL FindTask
- X TST.L D0
- X BNE.S NameFound
- XNotTheTaskList:
- X
- X; Search the port list
- X
- X TST.L ArgArray+2*4(GP)
- X BEQ.S NotThePortList
- X MOVE.L ArgArray(GP),A1
- X CALL FindPort
- X TST.L D0
- X BNE.S NameFound
- XNotThePortList
- X
- X; Clear returncode if name not in any list. Permit and pop ARP base.
- X
- X CLR.W ReturnCode(GP)
- XNameFound:
- X CALL Permit
- X MOVE.L (SP)+,A6
- X
- X; Done, cleanup
- X
- XExit:
- X SUB.L ErrorStrPtr,ErrorStrPtr
- XErrorExit:
- X
- X; Display error string, if any, and exit
- X
- X MOVE.L ErrorStrPtr,D0
- X BEQ.S NoErrorMsg
- X MOVE.L D0,A1
- X CALL Puts
- XNoErrorMsg:
- X RTS
- X
- X; The string section
- X
- XTemplate:
- X DC.B 'Name/a,Task/s,Port/s',0
- XHelpMsg:
- X DC.B 'CheckList - Check system list for name. RC=5 if found.',10
- X DC.B 'Usage: CheckList "namestring" [Task] [Port]',0
- XNoListSpec:
- X DC.B 'Need list specifier!',0
- X CNOP 0,2
- X
- X END
- END_OF_FILE
- if test 1657 -ne `wc -c <'CheckList/CheckList.asm'`; then
- echo shar: \"'CheckList/CheckList.asm'\" unpacked with wrong size!
- fi
- # end of 'CheckList/CheckList.asm'
- fi
- if test -f 'CheckList/CheckList.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'CheckList/CheckList.man'\"
- else
- echo shar: Extracting \"'CheckList/CheckList.man'\" \(627 characters\)
- sed "s/^X//" >'CheckList/CheckList.man' <<'END_OF_FILE'
- X
- XNAME
- X CheckList - Check system list for name.
- X
- X
- XSYNOPSIS
- X CheckList "namestring" [Task] [Port]
- X
- X
- XREQUIREMENTS
- X The ARP library
- X
- X
- XDESCRIPTION
- X This command checks the task list or the port list for a task or
- X port with the name you specified. The search is case dependent.
- X CheckList returns return code 5 if the name matches a list item.
- X If the name doesn't check out, the return code will be zero.
- X
- X
- XEXAMPLE
- X This batch loads a program FOO, that uses a message port named
- X "FOO_port", when FOO hasn't been run already.
- X
- X CheckList FOO_port Port
- X If WARN ; WARN = 5
- X Echo "FOO already loaded!"
- X Else
- X Run FOO
- X EndIf
- END_OF_FILE
- if test 627 -ne `wc -c <'CheckList/CheckList.man'`; then
- echo shar: \"'CheckList/CheckList.man'\" unpacked with wrong size!
- fi
- # end of 'CheckList/CheckList.man'
- fi
- if test -f 'CheckList/CheckList.uu' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'CheckList/CheckList.uu'\"
- else
- echo shar: Extracting \"'CheckList/CheckList.uu'\" \(701 characters\)
- sed "s/^X//" >'CheckList/CheckList.uu' <<'END_OF_FILE'
- Xbegin 644 CheckList
- XM```#\P`````````!``````````````!M```#Z0```&U@"DK\```/H`````!.J
- XM5?_F(D]"6;O)9OH[?`!D__8K2/_\*T#_^"QX``1#^@!7<"=.KOW82H!F7D/ZY
- XM`#1.KOW82H!G("Q`3J[_Q"(`9PQ!^@`J)`AV&TZN_]`B3BQX``1.KOYB,"W_3
- XM]DB`3EU.=61O<RYL:6)R87)Y`'EO=2!N965D(&%R<"YL:6)R87)Y`"!6,SDK!
- XM"@`L0#M\`!3_]F$"8+@@;?_\("W_^$/Z`(U%[?_F1_H`<"2)3J[_!"A22H!GF
- XM``!6:P``4DGZ`-)*K?_J9@9*K?_N9T`O#BQX``1.KO]\.WP`!?_V2JW_ZF<,?
- XM(FW_YDZN_MI*@&862JW_[F<,(FW_YDZN_GI*@&8$0FW_]DZN_W8L7YG,(`QG9
- XM!B)`3J[_$$YU3F%M92]A+%1A<VLO<RQ0;W)T+W,`0VAE8VM,:7-T("T@0VAE2
- XM8VL@<WES=&5M(&QI<W0@9F]R(&YA;64N(%)#/34@:68@9F]U;F0N"E5S86=E$
- XM.B!#:&5C:TQI<W0@(FYA;65S=')I;F<B(%M487-K72!;4&]R=%T`3F5E9"!L@
- X6:7-T('-P96-I9FEE<B$````````#\F<B)
- X``
- Xend
- Xsize 472
- END_OF_FILE
- if test 701 -ne `wc -c <'CheckList/CheckList.uu'`; then
- echo shar: \"'CheckList/CheckList.uu'\" unpacked with wrong size!
- fi
- # end of 'CheckList/CheckList.uu'
- fi
- if test ! -d 'Clip' ; then
- echo shar: Creating directory \"'Clip'\"
- mkdir 'Clip'
- fi
- if test -f 'Clip/Clip.asm' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Clip/Clip.asm'\"
- else
- echo shar: Extracting \"'Clip/Clip.asm'\" \(6115 characters\)
- sed "s/^X//" >'Clip/Clip.asm' <<'END_OF_FILE'
- X; Clip input lines on specified locations and write result to standard output.
- X
- X INCLUDE "/include/init.i"
- X
- X; OPT D+
- X
- X; Local Equs
- X
- XMaxLineSize EQU 512
- X
- X; Variable storage
- X
- X STRUCT ArgArray,(4+1)*4
- X LONG StdIn
- X LONG StdOut
- X LONG ByteFetch
- X LONG ReadBytesLeft
- X LONG Count1
- X LONG Count2
- X LONG Delta1
- X LONG Delta2
- X LONG ID1StrPtr
- X LONG ID2StrPtr
- X LONG ID1Exclusive
- X LONG ID2Exclusive
- X SIZE
- X
- X; Regs
- X
- X
- XDelta EQUR D4
- XCount EQUR D5
- XLineBufPtr EQUR D6
- XLineBufLeft EQUR D7
- XLineEndPtr EQUR A2
- XIDStrPtr EQUR A3
- XErrorStrPtr EQUR A4
- X
- X; Startup
- X
- X STACK 4000
- X INIT
- X
- X; Let ARP interpret the commandline
- X
- X MOVE.L ComLineBase(GP),A0
- X MOVE.L ComLineSize(GP),D0
- X LEA HelpMsg(PC),A1
- X LEA ArgArray(GP),A2
- X LEA Template(PC),A3
- X MOVE.L A1,(A2)
- X CALL GADS
- X MOVE.L (A2),ErrorStrPtr
- X TST.L D0
- X BEQ ErrorExit
- X BMI ErrorExit
- X
- X; Interpret the count values
- X
- X MOVE.L ArgArray+0*4(GP),A0
- X BSR GetSignedNum
- X BEQ ErrorExit
- X MOVE.L D0,Count1(GP)
- X MOVE.L D1,Delta1(GP)
- X
- X MOVE.L ArgArray+2*4(GP),A0
- X BSR GetSignedNum
- X BEQ ErrorExit
- X MOVE.L D0,Count2(GP)
- X MOVE.L D1,Delta2(GP)
- X
- X; Interpret the ID strings
- X
- X LEA EmptyString(PC),A1
- X
- X MOVE.L ArgArray+1*4(GP),D0
- X BNE.S ID1StringSpecified
- X MOVE.L A1,D0
- XID1StringSpecified:
- X MOVE.L D0,A0
- X
- X CMP.B #'x',(A0)
- X BNE.S NoID1Exclusion
- X ADDQ.L #1,A0
- X ADDQ.L #1,ID1Exclusive(GP)
- XNoID1Exclusion:
- X MOVE.L A0,ID1StrPtr(GP)
- X
- X MOVE.L ArgArray+3*4(GP),D0
- X BNE.S ID2StringSpecified
- X MOVE.L A1,D0
- XID2StringSpecified:
- X MOVE.L D0,A0
- X
- X CMP.B #'x',(A0)
- X BNE.S NoID2Exclusion
- X ADDQ.L #1,A0
- X ADDQ.L #1,ID2Exclusive(GP)
- XNoID2Exclusion:
- X MOVE.L A0,ID2StrPtr(GP)
- X
- X; Open the standard input & output
- X
- X CALL Input
- X MOVE.L D0,StdIn(GP)
- X CALL Output
- X MOVE.L D0,StdOut(GP)
- X
- X; Allocate the read-line buffer
- X
- X LEA OutOfMem(PC),ErrorStrPtr
- X MOVE.L #MaxLineSize+4+MaxLineSize,D0 ; 2 part buf with 0 term space.
- X MOVEQ #0,D1
- X CALL ArpAllocMem
- X MOVE.L D0,LineBufPtr
- X BEQ ErrorExit
- X
- X
- X; ** This is an intelligent ReadLine routine.
- X
- X; Reinitialize the line buffer. (First part of dual buffer space)
- X
- XDoForEachLine:
- X LEA ReadError(PC),ErrorStrPtr
- X MOVE.L LineBufPtr,LineEndPtr
- X MOVE.L #MaxLineSize,LineBufLeft
- X
- X; Extract lines from the readbuffer into the line buffer.
- X
- X BRA.S ExtractEntry
- XCopyLineBytes:
- X MOVE.L ByteFetch(GP),A0
- X ADDQ.L #1,ByteFetch(GP)
- X SUBQ.L #1,ReadBytesLeft(GP)
- X MOVE.B (A0),D0
- X CMP.B #10,D0
- X BEQ.S GotLine
- X MOVE.B D0,(LineEndPtr)+
- X SUBQ.L #1,LineBufLeft
- X BEQ.S GotLine
- XExtractEntry:
- X TST.L ReadBytesLeft(GP) ; Stack vars 0 init
- X BNE CopyLineBytes
- X
- X; Refill the read buffer.
- X
- X MOVE.L StdIn(GP),D1
- X MOVE.L LineBufPtr,D2
- X MOVE.L #MaxLineSize,D3
- X ADD.L D3,D2
- X ADDQ.L #4,D2
- X CALL Read
- X TST.L D0
- X BMI ErrorExit
- X BNE.S NotYetDone
- X CMP.L LineBufPtr,LineEndPtr
- X BEQ.S Exit
- XNotYetDone:
- X MOVE.L D2,ByteFetch(GP)
- X MOVE.L D0,ReadBytesLeft(GP)
- X BNE CopyLineBytes
- X
- X; Adjust end of line pointer and weed out empty lines
- X
- XGotLine:
- X SUBQ.L #1,LineEndPtr
- X CMP.L LineBufPtr,LineEndPtr
- X BLO DoForEachLine
- X
- X; Find the initial clip postition
- X
- X MOVE.L LineBufPtr,A0
- X MOVE.L Delta1(GP),Delta
- X BPL.S InitialPosSet
- X MOVE.L LineEndPtr,A0
- XInitialPosSet:
- X MOVE.L Count1(GP),Count
- X MOVE.L ID1StrPtr(GP),IDStrPtr
- X BSR.S FindClipPosition
- X BNE DoForEachLine
- X MOVE.L A0,D3
- X
- X; Find the secondary clip postition.
- X
- X MOVE.L Delta2(GP),Delta
- X MOVE.L Count2(GP),Count
- X MOVE.L ID2StrPtr(GP),IDStrPtr
- X BSR.S FindClipPosition
- X BNE DoForEachLine
- X
- X; Adjust for direction, adjust for exclusion and compute the length.
- X
- X MOVE.L ID1Exclusive(GP),D0
- X MOVE.L ID2Exclusive(GP),D1
- X CMP.L A0,D3
- X BHI.S InvertedDirection
- X EXG D0,D1
- X EXG A0,D3
- XInvertedDirection:
- X ADD.L D1,A0
- X SUB.L D0,D3
- X SUB.L A0,D3
- X BMI DoForEachLine
- X ADDQ.L #2,D3
- X
- X; Terminate with a LF and write the line clip.
- X
- X LEA WriteError(PC),ErrorStrPtr
- X MOVE.B #10,-1(A0,D3.L)
- X MOVE.L StdOut(GP),D1
- X MOVE.L A0,D2
- X CALL Write
- X CMP.L D0,D3
- X BNE.S ErrorExit
- XWriteDone:
- X
- X; Check if user hit ^C
- X
- XSkipWrite:
- X SUB.L A1,A1
- X CALL CheckAbort
- X MOVE.L A1,ErrorStrPtr
- X TST.L D0
- X BNE.S ErrorExit
- X BRA DoForEachLine
- X
- X; Done, cleanup
- X
- XExit:
- X CLR.W ReturnCode(GP)
- X SUB.L ErrorStrPtr,ErrorStrPtr
- XErrorExit:
- X
- X; Display error string, if any, and exit
- X
- X MOVE.L ErrorStrPtr,D0
- X BEQ.S NoErrorMsg
- X MOVE.L D0,A1
- X CALL Puts
- XNoErrorMsg:
- X RTS
- X
- X; Subroutines
- X
- X; This subroutine tried to find the CNTth position in the current line (relative
- X; to the initial position) which matches the ID string.
- X; I : A0 = Initial search position
- X; O : A0 = Clip position
- X; : Z=1 if search succeeded.
- X; : LineBufPtr,LineEndPtr,Delta,Count,IDStrPtr should be initialized
- X
- XFindClipPosition:
- X
- X; Set the boundary to check with in D0 (Given position movement direction)
- X
- X MOVE.L LineBufPtr,D0
- X TST.L Delta
- X BMI.S FetchedRelevantBoundary
- X MOVE.L LineEndPtr,D0
- XFetchedRelevantBoundary:
- X
- X; Check if all matches found or boundary reached. If not move current position.
- X
- X TST.L Count
- XCheckNextByte:
- X BEQ.S GotClipPosition
- XNoByteMatch:
- X CMP.L D0,A0
- X BEQ.S AtLineBoundary
- X ADD.L Delta,A0
- X
- X; Check byte on the current position matched the ID string.
- X
- X TST.B (IDStrPtr)
- X BEQ.S ByteMatched
- X MOVE.L IDStrPtr,A1
- X MOVE.B (A0),D1
- XTryToMatchNextByte:
- X CMP.B (A1)+,D1
- X BEQ.S ByteMatched
- X TST.B (A1)
- X BEQ NoByteMatch
- X BRA TryToMatchNextByte
- XByteMatched:
- X SUBQ.L #1,Count
- X BRA CheckNextByte
- X
- X; Done. Take care of the Z-flag.
- X
- XAtLineBoundary:
- X TST.B (IDStrPtr)
- XGotClipPosition:
- X RTS
- X
- X; This sub decodes an ASCII buffer containing a signed number to a positive
- X; number and a sign boolean. It also sets ErrorStrPtr to "Invalid count"
- X; I : A0 = Ptr ASCII buffer
- X; O : D0.L = Integer >= 0
- X; : D1.L = +1 if positive, -1 if negative
- X; : Z = 1 if error
- X
- XGetSignedNum:
- X LEA InvalidCnt(PC),ErrorStrPtr
- X MOVEQ #-1,D1
- X CMP.B #'-',(A0)+
- X BEQ.S ConvertToLong
- X MOVEQ #+1,D1
- X CMP.B #'+',-(A0)
- X BNE.S ConvertToLong
- X ADDQ.L #1,A0
- XConvertToLong:
- X MOVE.L D1,-(SP)
- X CALL Atol
- X MOVEM.L (SP)+,D1
- X RTS
- X
- X; The string section
- X
- XTemplate:
- X DC.B 'CNT1/a,ID1/k,CNT2/a,ID2/k',0
- XHelpMsg:
- X DC.B 'Clip - Pipe through clipped lines.',10
- X DC.B 'Usage: Clip <Cnt1> [ID1 [x]"charlist"] <RelCnt2> [ID2 [x]"charlist"]',0
- XOutOfMem:
- X DC.B 'Out of memory!',0
- XInvalidCnt:
- X DC.B 'Invalid count',0
- XReadError:
- X DC.B 'Error while reading',0
- XWriteError:
- X DC.B 'Error while writing',0
- XEmptyString:
- X DC.B 0
- X CNOP 0,2
- X
- X END
- END_OF_FILE
- if test 6115 -ne `wc -c <'Clip/Clip.asm'`; then
- echo shar: \"'Clip/Clip.asm'\" unpacked with wrong size!
- fi
- # end of 'Clip/Clip.asm'
- fi
- if test -f 'Clip/Clip.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Clip/Clip.man'\"
- else
- echo shar: Extracting \"'Clip/Clip.man'\" \(1706 characters\)
- sed "s/^X//" >'Clip/Clip.man' <<'END_OF_FILE'
- X
- XNAME
- X Clip - Pipe through clipped lines.
- X
- X
- XSYNOPSIS
- X Clip <Cnt1> [ID1 [x]"charlist"] <Cnt2> [ID2 [x]"charlist"]
- X
- X
- XREQUIREMENTS
- X The ARP library
- X
- X
- XDESCRIPTION
- X Clip is a flexible tool for clipping pieces out of input lines.
- X Two clip positions may be specified, and, for every input line,
- X the text between the clip positions is written to the standard
- X output.
- X The first clip position is relative to the leftmost byte for
- X positive count values, and relative to the rightmost byte for
- X negative ones. The CNTth byte matching any of the bytes in the
- X ID's character list is the clip position.
- X If the ID string is headed by an "x", the character at the
- X clip position will be excluded from the clip. If no bytes are
- X specified in the character list, clip will match any byte. Clip
- X will default to this if you omit the ID parameter.
- X If a clip position couldn't be matched, no clip will be written.
- X If, however, no ID is specified, the clip position will be at the
- X last byte matched. For large CNT values this will probably be the
- X first or last byte of the input line.
- X Empty lines are ignored.
- X
- XEXAMPLES
- X Clip <TextFile 0 79
- X Type only the first 80 columns of a textfile to the console.
- X This prevents line wraps.
- X
- X Assume input lines with paths+filenames; Clip -1 ID1 "x:/" +400
- X will pass through only the filenames, and Clip -1 ID1 ":/" -400
- X will pass through the paths.
- X
- X Assign | Search STDIN volumename: NONUM | Clip 0 +1 ID2 "x " |
- X PForm "Assign %s:" | Execute
- X This line will clear a set of logical device names specific to a
- X volume.
- X
- X
- XBUGS/LIMITATIONS
- X The counts start from 0. This is counter-intuitive. Think of them
- X as offsets, the first from the edges, the second from the first.
- END_OF_FILE
- if test 1706 -ne `wc -c <'Clip/Clip.man'`; then
- echo shar: \"'Clip/Clip.man'\" unpacked with wrong size!
- fi
- # end of 'Clip/Clip.man'
- fi
- if test -f 'Clip/Clip.uu' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Clip/Clip.uu'\"
- else
- echo shar: Extracting \"'Clip/Clip.uu'\" \(1255 characters\)
- sed "s/^X//" >'Clip/Clip.uu' <<'END_OF_FILE'
- Xbegin 644 Clip
- XM```#\P`````````!``````````````#1```#Z0```-%@"DK\```/H`````!.R
- XM5?^R(D]"6;O)9OH[?`!D__8K2/_\*T#_^"QX``1#^@!7<"=.KOW82H!F7D/Z%
- XM`#1.KOW82H!G("Q`3J[_Q"(`9PQ!^@`J)`AV&TZN_]`B3BQX``1.KOYB,"W_3
- XM]DB`3EU.=61O<RYL:6)R87)Y`'EO=2!N965D(&%R<"YL:6)R87)Y`"!6,SDK!
- XM"@`L0#M\`!3_]F$"8+@@;?_\("W_^$/Z`>A%[?_B1_H!QB2)3J[_!"A22H!G5
- XM``%>:P`!6B!M_^)A``&*9P`!3BM`_\XK0?_&(&W_ZF$``79G``$Z*T#_RBM!N
- XM_\)#^@)/("W_YF8"(`D@0`P0`'AF!E*(4JW_MBM(_[X@+?_N9@(@"2!`#!``W
- XM>&8&4HA2K?^R*TC_NDZN_\HK0/_>3J[_Q"M`_]I)^@'"(#P```0$<@!.KOYZZ
- XM+`!G``#42?H!R21&+CP```(`8!H@;?_64JW_UE.M_](0$+`\``IG-A3`4X=G3
- XM,$JM_])FX"(M_]XD!B8\```"`-2#6().KO_62H!K``",9@2UQF=^*T+_UBM`R
- XM_])FME.*M<9EHB!&*"W_QFH"($HJ+?_.)FW_OF%L9HPF""@M_\(J+?_*)FW_+
- XMNF%:9@#_>B`M_[8B+?^RMHAB!,%!QXC1P9:`EHAK`/]@5(-)^@$Y$;P`"CC_]
- XM(BW_VB0(3J[_T+:`9A:3R4ZN_O(H24J`9@I@`/\V0FW_]IG,(`QG!B)`3J[_8
- XM$$YU(`9*A&L"(`I*A6<>L<!G&-'$2A-G#B)+$A"R&6<&2A%GZF#V4X5@XDH3)
- XM3G5)^@"Q<O\,&``M9PIR`0P@`"MF`E*(+P%.KO[^3-\``DYU0TY4,2]A+$E$M
- XM,2]K+$-.5#(O82Q)1#(O:P!#;&EP("T@4&EP92!T:')O=6=H(&-L:7!P960@H
- XM;&EN97,N"E5S86=E.B!#;&EP(#Q#;G0Q/B!;240Q(%MX72)C:&%R;&ES=")=>
- XM(#Q296Q#;G0R/B!;240R(%MX72)C:&%R;&ES=")=`$]U="!O9B!M96UO<GDA@
- XM`$EN=F%L:60@8V]U;G0`17)R;W(@=VAI;&4@<F5A9&EN9P!%<G)O<B!W:&ELK
- X192!W<FET:6YG`````````_)RP
- X``
- Xend
- Xsize 872
- END_OF_FILE
- if test 1255 -ne `wc -c <'Clip/Clip.uu'`; then
- echo shar: \"'Clip/Clip.uu'\" unpacked with wrong size!
- fi
- # end of 'Clip/Clip.uu'
- fi
- if test -f 'ExecMe' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ExecMe'\"
- else
- echo shar: Extracting \"'ExecMe'\" \(163 characters\)
- sed "s/^X//" >'ExecMe' <<'END_OF_FILE'
- XProtect CheckList/CheckList +p
- XProtect Clip/Clip +p
- XProtect FilTex/FilTex +p
- XProtect NoReq/NoReq +p
- XProtect PForm/PForm +p
- XProtect Tee/Tee +p
- XProtect WBTF/WBTF +p
- END_OF_FILE
- if test 163 -ne `wc -c <'ExecMe'`; then
- echo shar: \"'ExecMe'\" unpacked with wrong size!
- fi
- # end of 'ExecMe'
- fi
- if test ! -d 'FilTex' ; then
- echo shar: Creating directory \"'FilTex'\"
- mkdir 'FilTex'
- fi
- if test -f 'FilTex/FilTex.asm' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'FilTex/FilTex.asm'\"
- else
- echo shar: Extracting \"'FilTex/FilTex.asm'\" \(5882 characters\)
- sed "s/^X//" >'FilTex/FilTex.asm' <<'END_OF_FILE'
- X; Filter non-text bytes from pipe stream.
- X
- X INCLUDE "/include/init.i"
- X
- X; Local Equs
- X; FilTex uses a buffer split into two 1000 byte parts, the first for writing,
- X; the last part for reading. Reads/Writes are HalfBufSize bytes large max.
- X
- XDefaultThreshold EQU 4
- XBufSize EQU 2000 ; Keep this one < 32K
- XHalfBufSize EQU BufSize/2
- X
- X; Variable storage
- X
- X STRUCT ArgArray,(4+1)*4
- X LONG InputHandle
- X LONG StdOutput
- X WORD Threshold
- X SIZE
- X
- X; Regs
- X
- XWriteBufIndex EQUR D4
- XReadBufIndex EQUR D5
- XReadBytesLeft EQUR D6
- XLatestByte EQUR D7
- XBufferPtr EQUR A2
- XFilterTablePtr EQUR A3
- XErrorStrPtr EQUR A4
- X
- X; Start
- X
- X STACK 4000
- X INIT
- X
- X; Let ARP interpret the commandline
- X
- X MOVE.L ComLineBase(GP),A0
- X MOVE.L ComLineSize(GP),D0
- X LEA HelpMsg(PC),A1
- X LEA ArgArray(GP),A2
- X LEA Template(PC),A3
- X MOVE.L A1,(A2)
- X CALL GADS
- X MOVE.L (A2),ErrorStrPtr
- X TST.L D0
- X BEQ ErrorExit
- X BMI ErrorExit
- X
- X; Fetch & check the threshold value.
- X
- X LEA BadThreshold(PC),ErrorStrPtr
- X MOVE.W #DefaultThreshold,Threshold(GP)
- X MOVE.L ArgArray+4(GP),A0
- X MOVE.L A0,D0
- X BEQ.S UseDefault
- X CALL Atol
- X BEQ ErrorExit
- X CMP.L #HalfBufSize,D0
- X BHI ErrorExit
- X MOVE.W D0,Threshold(GP)
- X BEQ ErrorExit
- XUseDefault:
- X
- X; Check if the source is STDIN, if so open that.
- X
- X MOVE.L ArgArray(GP),A0
- X LEA StdinID(PC),A1
- X CALL Strcmp
- X BNE.S NoStdin
- X CALL Input
- X MOVE.L D0,InputHandle(GP)
- X BRA.S InFileOpened
- XNoStdin:
- X
- X; Else open a normal source file (Tracked)
- X
- X LEA SourceOpenError(PC),ErrorStrPtr
- X MOVE.L ArgArray(GP),D1
- X MOVE.L #MODE_OLDFILE,D2
- X CALL ArpOpen
- X MOVE.L D0,InputHandle(GP)
- X BEQ ErrorExit
- XInFileOpened:
- X
- X; Fetch the StdOutput
- X
- X CALL Output
- X MOVE.L D0,StdOutput(GP)
- X
- X; Alloc tracked mem for the read/write buffer.
- X
- X LEA OutOfMem(PC),ErrorStrPtr
- X MOVE.L #BufSize+1,D0 ; add 1 to allow for LF termination
- X MOVEQ #0,D1
- X CALL ArpAllocMem
- X TST.L D0
- X BEQ ErrorExit
- X MOVE.L D0,BufferPtr
- X
- X; Initialize for the filtered copy loop
- X
- X LEA FilterTableBase(PC),FilterTablePtr
- X MOVEQ #0,WriteBufIndex
- X
- X; Read next chunk of bytes.
- X
- XDoNextRead:
- X LEA ReadError(PC),ErrorStrPtr
- X MOVEQ #0,ReadBufIndex
- X MOVE.W #HalfBufSize,ReadBufIndex
- X MOVE.L InputHandle(GP),D1
- X MOVE.L BufferPtr,D2
- X ADD.L ReadBufIndex,D2
- X MOVE.L ReadBufIndex,D3
- X CALL Read
- X MOVE.W D0,ReadBytesLeft
- X BMI ErrorExit
- X BEQ.S TryToWriteWriteBuffer
- X
- X; Find text bytes.
- X
- XCheckForTextBytes:
- X MOVEQ #0,LatestByte
- X MOVE.B 0(BufferPtr,ReadBufIndex.W),LatestByte
- X ADDQ.W #1,ReadBufIndex
- X SUBQ.W #1,ReadBytesLeft
- X TST.B 0(FilterTablePtr,LatestByte.W)
- X BEQ.S TryToWriteWriteBuffer
- X
- X; Process text bytes
- X
- X MOVE.B LatestByte,0(BufferPtr,WriteBufIndex.W)
- X ADDQ.W #1,WriteBufIndex
- X CMP.W #HalfBufSize,WriteBufIndex
- X BNE.S CheckReadBufStatus
- X
- X; Check if the number of bytes to write equals or exceeds the threshold
- X
- XTryToWriteWriteBuffer:
- X CMP.W Threshold(GP),WriteBufIndex
- X BLO.S NeLeWritezPas
- X
- X; Check if string is null-terminated (if requested to do so)
- X
- X TST.L ArgArray+12(GP) ; Check NULT switch
- X BEQ.S NoNullCheck
- X TST.B LatestByte
- X BNE.S NeLeWritezPas
- XNoNullCheck:
- X
- X; Terminate write with a linefeed if needed & not prohibited
- X
- X CMP.B #10,-1(BufferPtr,WriteBufIndex.W)
- X BEQ.S DoTheWrite
- X TST.L ArgArray+8(GP) ; Check NOLF switch
- X BNE.S DoTheWrite
- X MOVE.B #10,0(BufferPtr,WriteBufIndex.W)
- X ADDQ.W #1,WriteBufIndex
- X
- X; The actual write to the StdOutput
- X
- XDoTheWrite:
- X LEA WriteError(PC),ErrorStrPtr
- X MOVE.L StdOutput(GP),D1
- X MOVE.L BufferPtr,D2
- X MOVE.W WriteBufIndex,D3
- X EXT.L D3
- X CALL Write
- X CMP.L D0,D3
- X BNE.S ErrorExit
- X
- X; Check if user hit ^C
- X
- X SUB.L A1,A1
- X CALL CheckAbort
- X MOVE.L A1,ErrorStrPtr
- X TST.L D0
- X BNE.S ErrorExit
- XNeLeWritezPas:
- X
- X; Reset the write buffer index.
- X
- X MOVEQ #0,WriteBufIndex
- X
- X; Check if no more read bytes left, if so read, exit if last read had zero length
- X; (An adjective, verb and a noun. YOU try 'n make a natural language interpreter!)
- X
- XCheckReadBufStatus:
- X TST.W ReadBytesLeft
- X BNE CheckForTextBytes
- X CMP.W #HalfBufSize,ReadBufIndex
- X BNE DoNextRead
- X
- X; Done, cleanup
- X
- XExit:
- X CLR.W ReturnCode(GP)
- X SUB.L ErrorStrPtr,ErrorStrPtr
- XErrorExit:
- X
- X; Display error string, if any, and exit
- X
- X MOVE.L ErrorStrPtr,D0
- X BEQ.S NoErrorMsg
- X MOVE.L D0,A1
- X CALL Puts
- XNoErrorMsg:
- X RTS
- X
- X; The string section
- X
- XTemplate:
- X DC.B 'File/a,THRESH/k,NOLF/s,NULT/s',0
- XHelpMsg:
- X DC.B 'FilTex - filter out non-text.',10
- X DC.B 'Usage: FilTex <File | STDIN> [THRESH #] [NOLF] [NULT]',0
- XStdinID:
- X DC.B 'STDIN',0
- XBadThreshold:
- X DC.B 'Illegal threshold value',0
- XSourceOpenError:
- X DC.B 'Could not open source file',0
- XOutOfMem:
- X DC.B 'Out of memory!',0
- XReadError:
- X DC.B 'Error while reading',0
- XWriteError:
- X DC.B 'Error while writing',0
- X CNOP 0,4
- X
- X; This is the filtering array
- X
- X DC.B 'TextTab:'
- XFilterTableBase:
- X; 0 1 2 3 4 5 6 7 8 9 A B C D E F
- X DC.B 000,000,000,000,000,000,000,000,000,$09,$0A,000,000,000,000,000 ;0
- X DC.B 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;1
- X DC.B ' ','!','"','#','$','%','&',$27,'(',')','*','+',',','-','.','/' ;2
- X DC.B '0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?' ;3
- X DC.B 000,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O' ;4
- X DC.B 'P','Q','R','S','T','U','V','W','X','Y','Z','[','\',']','^','_' ;5
- X DC.B 000,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o' ;6
- X DC.B 'p','q','r','s','t','u','v','w','x','y','z','{','|','}','~',000 ;7
- X DC.B 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;8
- X DC.B 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;9
- X DC.B 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;A
- X DC.B 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;B
- X DC.B 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;C
- X DC.B 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;D
- X DC.B 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;E
- X DC.B 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;F
- X; 0 1 2 3 4 5 6 7 8 9 A B C D E F
- X END
- END_OF_FILE
- if test 5882 -ne `wc -c <'FilTex/FilTex.asm'`; then
- echo shar: \"'FilTex/FilTex.asm'\" unpacked with wrong size!
- fi
- # end of 'FilTex/FilTex.asm'
- fi
- if test -f 'FilTex/FilTex.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'FilTex/FilTex.man'\"
- else
- echo shar: Extracting \"'FilTex/FilTex.man'\" \(1787 characters\)
- sed "s/^X//" >'FilTex/FilTex.man' <<'END_OF_FILE'
- X
- XNAME
- X FilTex - Filter text
- X
- X
- XSYNOPSIS
- X FilTex <File | STDIN> [THRESH #] [NOLF] [NULT]
- X
- X
- XREQUIREMENTS
- X The ARP library
- X
- X
- XDESCRIPTION
- X FilTex reads a file, removes all non-text characters, and writes
- X the result to the standard output. The found chunks of text are
- X terminated with linefeeds if they weren't already.
- X FilTex recognizes most normal ASCII codes + TAB & LF as being text.
- X The optional THRESH keyword may be followed by a number indicating
- X the minimum number of subsequent text bytes required for FilTex to
- X recognize a chunk of bytes as being text. The default is 4.
- X If you do not want the terminating linefeeds, specify the NOLF
- X switch.
- X The NULT option causes FilTex to pass only null-terminated strings.
- X This option reduces the percentage of bogus strings FilTex finds.
- X Still, not all text strings in a program file are guaranteed to be
- X null-terminated.
- X
- X
- XEXAMPLES
- X prompt> FilTex >Clues Adventure
- X Find pieces of text in a program file.
- X
- X
- XBUGS/LIMITATIONS
- X -FilTex does not recognize "@", "`", the extended ASCII values
- X and most control codes as being text. This improves the
- X filter's selectivity. If you need umlauts or whatever,
- X look at the source and reassemble, or use a file-zapper and
- X search for the string 'TextTab:'. This string is followed
- X directly by an array of 256 bytes, the Nth byte corresponding
- X to the Nth ASCII code. If the byte is nonzero, its location
- X index will be recognized as a text value. For zapping clarity,
- X I've given each text location its (nonzero) ASCII value.
- X -FilTex is only a very simple filter. It therefore passes through
- X a lot of garbage text strings if you're filtering binary code.
- X The NULT option improves the performance only slightly because
- X your average binary code contains a lot of nulls.
- END_OF_FILE
- if test 1787 -ne `wc -c <'FilTex/FilTex.man'`; then
- echo shar: \"'FilTex/FilTex.man'\" unpacked with wrong size!
- fi
- # end of 'FilTex/FilTex.man'
- fi
- if test -f 'FilTex/FilTex.uu' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'FilTex/FilTex.uu'\"
- else
- echo shar: Extracting \"'FilTex/FilTex.uu'\" \(1471 characters\)
- sed "s/^X//" >'FilTex/FilTex.uu' <<'END_OF_FILE'
- Xbegin 644 FilTex
- XM```#\P`````````!``````````````#W```#Z0```/=@"DK\```/H`````!.^
- XM5?_8(D]"6;O)9OH[?`!D__8K2/_\*T#_^"QX``1#^@!7<"=.KOW82H!F7D/ZK
- XM`#1.KOW82H!G("Q`3J[_Q"(`9PQ!^@`J)`AV&TZN_]`B3BQX``1.KOYB,"W_3
- XM]DB`3EU.=61O<RYL:6)R87)Y`'EO=2!N965D(&%R<"YL:6)R87)Y`"!6,SDK!
- XM"@`L0#M\`!3_]F$"8+@@;?_\("W_^$/Z`6)%[?_B1_H!/"2)3J[_!"A22H!G%
- XM``$B:P`!'DGZ`9X[?``$_]@@;?_F(`AG&DZN_OYG``$$L+P```/H8@``^CM`.
- XM_]AG``#R(&W_XD/Z`6A.KOWV9@I.KO_**T#_WF`:2?H!<B(M_^(D/````^U.N
- XMKOYT*T#_WF<``,!.KO_$*T#_VDGZ`6L@/```!]%R`$ZN_GI*@&<``*(D0$?Z3
- XM`91X`$GZ`5QZ`#H\`^@B+?_>)`K4A28%3J[_UCP`:P``?&<<?@`>,E``4D53E
- XM1DHS<`!G#!6'0`!21+A\`^AF2KAM_]AE0DJM_^YG!$H'9C@,,@`*0/]G#DJM[
- XM_^IF"!6\``I``%)$2?H!#B(M_]HD"C8$2,-.KO_0MH!F()/)3J[^\BA)2H!FE
- XM%'@`2D9FEKI\`^AF`/]P0FW_]IG,(`QG!B)`3J[_$$YU1FEL92]A+%1(4D53B
- XM2"]K+$Y/3$8O<RQ.54Q4+W,`1FEL5&5X("T@9FEL=&5R(&]U="!N;VXM=&5X0
- XM="X*57-A9V4Z($9I;%1E>"`\1FEL92!\(%-41$E./B!;5$A215-(("-=(%M.1
- XM3TQ&72!;3E5,5%T`4U1$24X`26QL96=A;"!T:')E<VAO;&0@=F%L=64`0V]UF
- XM;&0@;F]T(&]P96X@<V]U<F-E(&9I;&4`3W5T(&]F(&UE;6]R>2$`17)R;W(@U
- XM=VAI;&4@<F5A9&EN9P!%<G)O<B!W:&EL92!W<FET:6YG````5&5X=%1A8CH`P
- XM```````````)"@```````````````````````````"`A(B,D)28G*"DJ*RPMN
- XM+B\P,3(S-#4V-S@Y.CL\/3X_`$%"0T1%1D=(24I+3$U.3U!14E-455976%E:T
- XM6UQ=7E\`86)C9&5F9VAI:FML;6YO<'%R<W1U=G=X>7I[?'U^````````````B
- XM`````````````````````````````````````````````````````````````
- XM`````````````````````````````````````````````````````````````
- XB```````````````````````````````````````````#\@``U
- X``
- Xend
- Xsize 1024
- END_OF_FILE
- if test 1471 -ne `wc -c <'FilTex/FilTex.uu'`; then
- echo shar: \"'FilTex/FilTex.uu'\" unpacked with wrong size!
- fi
- # end of 'FilTex/FilTex.uu'
- fi
- if test ! -d 'Include' ; then
- echo shar: Creating directory \"'Include'\"
- mkdir 'Include'
- fi
- if test -f 'Include/init.i' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Include/init.i'\"
- else
- echo shar: Extracting \"'Include/init.i'\" \(3728 characters\)
- sed "s/^X//" >'Include/init.i' <<'END_OF_FILE'
- X; The stuff below is some pretty basic support and initialization, and
- X; should be replaced easily with the includes and macros used in your
- X; assembly system. I don't think you'll encounter many problems when
- X; trying to assemble this.
- X
- X OPT A-,M-,O+,O3-,OW-,I+,P+,S-,T+,W+,D-,X-
- X
- X; Define global variable structure pointer
- X
- XGP EQUR A5
- X
- X; Equs private to initialization code
- X
- XInitError EQU 100
- XNormError EQU 20
- X
- X; Some LVOs & equates (can be gotten by including dos*.i & arpbase.i etc.)
- X
- X_LVOArpAlloc EQU -384
- X_LVOArpAllocMem EQU -390
- X_LVOArpLock EQU -408
- X_LVOArpOpen EQU -396
- X_LVOAtol EQU -258
- X_LVOCheckAbort EQU -270
- X_LVOClose EQU -36
- X_LVOCloseDevice EQU -450
- X_LVOCloseLibrary EQU -414
- X_LVODoIO EQU -456
- X_LVODelay EQU -198
- X_LVODeleteFile EQU -72
- X_LVOExamine EQU -102
- X_LVOForbid EQU -132
- X_LVOFindPort EQU -390
- X_LVOFindTask EQU -294
- X_LVOGADS EQU -252
- X_LVOInput EQU -54
- X_LVOLock EQU -84
- X_LVOOpen EQU -30
- X_LVOOpenDevice EQU -444
- X_LVOOpenLibrary EQU -552
- X_LVOOpenWorkBench EQU -210
- X_LVOOutput EQU -60
- X_LVOPermit EQU -138
- X_LVOPuts EQU -240
- X_LVORawDoFmt EQU -522
- X_LVORead EQU -42
- X_LVOSeek EQU -66
- X_LVOSetProtection EQU -186
- X_LVOStamptoStr EQU -564
- X_LVOStrcmp EQU -522
- X_LVOUnLock EQU -90
- X_LVOWBenchToFront EQU -342
- X_LVOWrite EQU -48
- X
- XACCESS_READ EQU -2
- XACCESS_WRITE EQU -1
- XArpVersion EQU 39
- Xds_Days EQU 0
- Xds_Minute EQU 4
- Xds_Tick EQU 8
- Xfib_DateStamp EQU $84
- Xfib_SIZEOF EQU $104
- XFORMAT_DOS EQU 0
- XIO_COMMAND EQU $1C
- XIOTV_SIZE EQU $28
- XIOTV_TIME EQU $20
- XLEN_DATSTRING EQU 10
- XLN_NAME EQU $A
- XMEMF_CLEAR EQU $10000
- XMEMF_PUBLIC EQU 1
- XMN_REPLYPORT EQU $E
- XMODE_NEWFILE EQU $3EE
- XMODE_OLDFILE EQU $3ED
- XOFFSET_END EQU 1
- Xpr_MsgPort EQU $5C
- Xpr_WindowPtr EQU $B8
- XRESIDENT_MAGIC EQU $4AFC
- XThisTask EQU $114
- XTR_SETSYSTIME EQU $B
- XTV_SECS EQU 0
- X
- X; Negative structure building macros
- X
- XALIGN MACRO
- Xsoff SET soff-(soff&1)
- X ENDM
- X
- XSTRUCT MACRO
- Xsoff SET soff-\2
- X ALIGN
- X\1 EQU soff
- X ENDM
- X
- XLONG MACRO
- X ALIGN
- Xsoff SET soff-4
- X\1 EQU soff
- X ENDM
- X
- XWORD MACRO
- X ALIGN
- Xsoff SET soff-2
- X\1 EQU soff
- X ENDM
- X
- XBYTE MACRO
- Xsoff SET soff-1
- X\1 EQU soff
- X ENDM
- X
- XSIZE MACRO
- X ALIGN
- XStrcSize EQU soff
- X ENDM
- X
- X; Define default variables.
- X
- Xsoff SET 0
- X LONG ComLineBase
- X LONG ComLineSize
- X WORD ReturnCode
- X
- X; This requires A6 to be set properly! Keep track carefully or reload A6
- X
- XCALL MACRO
- X JSR _LVO\1(A6)
- X ENDM
- X
- X; This tells ARP's shell and resident how large a stack we require.
- X
- XSTACK MACRO
- X BRA.S ResStart
- X DC.W RESIDENT_MAGIC
- X DC.L \1
- X DC.L 0
- XResStart:
- X ENDM
- X
- X; The big one.
- X
- XINIT MACRO
- X
- X; Setup the stack structure (on stack for reentrability) (GP=A5, do not modify)
- X
- X LINK GP,#StrcSize
- X MOVE.L SP,A1
- XClearStackStruct:
- X CLR.W (A1)+
- X CMP.L A1,GP
- X BNE ClearStackStruct
- X
- X; Initialize default variables
- X
- X MOVE.W #InitError,ReturnCode(GP)
- X MOVE.L A0,ComLineBase(GP)
- X MOVE.L D0,ComLineSize(GP)
- X
- X; Try to open ARP
- X
- X MOVE.L $4.W,A6
- X LEA ArpName(PC),A1
- X MOVEQ #ArpVersion,D0
- X CALL OpenLibrary
- X TST.L D0
- X BNE.S OpenedOK
- X
- X; Report that the ARP library could not be opened.
- X
- X; MOVEQ #0,D0 ; Already 0
- X LEA DosName(PC),A1
- X CALL OpenLibrary
- X TST.L D0
- X BEQ.S ThisIsHorrible
- X MOVE.L D0,A6
- X CALL Output
- X MOVE.L D0,D1
- X BEQ.S BackToDOS
- X LEA LibErr(PC),A0
- X MOVE.L A0,D2
- X MOVEQ #StringEnd-LibErr,D3
- X CALL Write
- X
- X; Return to DOS
- X
- XBackToDOS:
- X MOVE.L A6,A1
- X MOVE.L $4.W,A6
- X CALL CloseLibrary
- XThisIsHorrible:
- X MOVE.W ReturnCode(GP),D0
- X EXT.W D0
- X UNLK GP
- X RTS
- X
- X; Support strings
- X
- X IFGE ArpVersion-100
- X FAIL "Version > 3 digits"
- X ENDC
- X
- XTMP SET ArpVersion/10
- XDosName DC.B 'dos.library',0
- XLibErr DC.B 'you need '
- XArpName DC.B 'arp.library',0,' V',TMP+'0',(ArpVersion-(TMP*10))+'0','+',10
- XStringEnd:
- X CNOP 0,2
- X
- X; A6 = ARP base (Do not modify A6 if you use CALL), lower error level, call user.
- X
- XOpenedOK:
- X MOVE.L D0,A6
- X MOVE.W #NormError,ReturnCode(GP)
- X BSR.S UserCode
- X BRA BackToDOS
- XUserCode:
- X ENDM
- END_OF_FILE
- if test 3728 -ne `wc -c <'Include/init.i'`; then
- echo shar: \"'Include/init.i'\" unpacked with wrong size!
- fi
- # end of 'Include/init.i'
- fi
- if test ! -d 'NoReq' ; then
- echo shar: Creating directory \"'NoReq'\"
- mkdir 'NoReq'
- fi
- if test -f 'NoReq/NoReq.asm' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'NoReq/NoReq.asm'\"
- else
- echo shar: Extracting \"'NoReq/NoReq.asm'\" \(282 characters\)
- sed "s/^X//" >'NoReq/NoReq.asm' <<'END_OF_FILE'
- X
- X INCLUDE "/include/init.i"
- X
- X; No sys funcs so no stack needed.
- X
- X STACK 100
- X
- X; Be done with it
- X
- X MOVE.L $4.W,A6
- X MOVE.L ThisTask(A6),A0
- X MOVEQ #-1,D0
- X CMP.L pr_WindowPtr(A0),D0
- X BNE.S NotYetInhibited
- X MOVEQ #0,D0
- XNotYetInhibited:
- X MOVE.L D0,pr_WindowPtr(A0)
- X MOVEQ #0,D0
- X RTS
- X
- X END
- END_OF_FILE
- if test 282 -ne `wc -c <'NoReq/NoReq.asm'`; then
- echo shar: \"'NoReq/NoReq.asm'\" unpacked with wrong size!
- fi
- # end of 'NoReq/NoReq.asm'
- fi
- if test -f 'NoReq/NoReq.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'NoReq/NoReq.man'\"
- else
- echo shar: Extracting \"'NoReq/NoReq.man'\" \(669 characters\)
- sed "s/^X//" >'NoReq/NoReq.man' <<'END_OF_FILE'
- X
- XNAME
- X NoReq - Toggle system requester inhibition.
- X
- X
- XSYNOPSIS
- X NoReq
- X
- X
- XREQUIREMENTS
- X None
- X
- X
- XDESCRIPTION
- X NoReq will set the WindowPtr field of its process to -1, thus
- X inhibiting the DOS from popping up system requesters if something
- X goes wrong with a DOS call by the process.
- X If you repeat this command the field will be switched back to 0.
- X Since a program inherits its process from the CLI/Shell from which
- X it was executed, NoReq effectively inhibits requester generation
- X by subsequent programs executed from the same CLI/Shell.
- X
- X
- XEXAMPLES
- X Add 'NoReq' to your Remote-Startup to avoid a remote Shell user
- X causing a requester to pop up, thus causing a deadlock.
- END_OF_FILE
- if test 669 -ne `wc -c <'NoReq/NoReq.man'`; then
- echo shar: \"'NoReq/NoReq.man'\" unpacked with wrong size!
- fi
- # end of 'NoReq/NoReq.man'
- fi
- if test -f 'NoReq/NoReq.uu' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'NoReq/NoReq.uu'\"
- else
- echo shar: Extracting \"'NoReq/NoReq.uu'\" \(141 characters\)
- sed "s/^X//" >'NoReq/NoReq.uu' <<'END_OF_FILE'
- Xbegin 644 NoReq
- XM```#\P`````````!```````````````*```#Z0````I@"DK\````9``````LW
- X?>``$(&X!%'#_L*@`N&8"<``A0`"X<`!.=0`````#\@I@A
- X``
- Xend
- Xsize 76
- END_OF_FILE
- if test 141 -ne `wc -c <'NoReq/NoReq.uu'`; then
- echo shar: \"'NoReq/NoReq.uu'\" unpacked with wrong size!
- fi
- # end of 'NoReq/NoReq.uu'
- fi
- if test ! -d 'PForm' ; then
- echo shar: Creating directory \"'PForm'\"
- mkdir 'PForm'
- fi
- if test -f 'PForm/PForm.asm' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'PForm/PForm.asm'\"
- else
- echo shar: Extracting \"'PForm/PForm.asm'\" \(4230 characters\)
- sed "s/^X//" >'PForm/PForm.asm' <<'END_OF_FILE'
- X; Format input lines to standard output
- X
- X INCLUDE "/include/init.i"
- X
- X; OPT D+
- X
- X; Local Equs
- X
- XFormatBufSize EQU 1500
- XMaxLineSize EQU 512
- XMaxFormatArgs EQU 20
- X
- X; Variable storage
- X
- X STRUCT ArgArray,(1+1)*4
- X STRUCT ArgStream,MaxFormatArgs*4
- X STRUCT FormatClipInfo,2*4
- X LONG StdIn
- X LONG StdOut
- X LONG FormatBufPtr
- X SIZE
- X
- X; Regs
- X
- XByteFetch EQUR D4
- XReadBytesLeft EQUR D5
- XLineBufPtr EQUR D6
- XLineBufLeft EQUR D7
- XLineEndPtr EQUR A2
- XErrorStrPtr EQUR A4
- X
- X; Startup
- X
- X STACK 4000
- X INIT
- X
- X; Let ARP interpret the commandline
- X
- X MOVE.L ComLineBase(GP),A0
- X MOVE.L ComLineSize(GP),D0
- X LEA HelpMsg(PC),A1
- X LEA ArgArray(GP),A2
- X LEA Template(PC),A3
- X MOVE.L A1,(A2)
- X CALL GADS
- X MOVE.L (A2),ErrorStrPtr
- X TST.L D0
- X BEQ ErrorExit
- X BMI ErrorExit
- X
- X; Open the standard input & output
- X
- X CALL Input
- X MOVE.L D0,StdIn(GP)
- X CALL Output
- X MOVE.L D0,StdOut(GP)
- X
- X; Alloc tracked mem for the string format buffer.
- X
- X LEA OutOfMem(PC),ErrorStrPtr
- X MOVE.L #FormatBufSize,D0
- X MOVEQ #0,D1
- X CALL ArpAllocMem
- X MOVE.L D0,FormatBufPtr(GP)
- X BEQ ErrorExit
- X
- X; Allocate the read-line buffer
- X
- X MOVE.L #MaxLineSize+4+MaxLineSize,D0 ; 2 part buf with 0 term space.
- X MOVEQ #0,D1
- X CALL ArpAllocMem
- X MOVE.L D0,LineBufPtr
- X BEQ ErrorExit
- X
- X; Initialize the argument stream
- X
- X MOVEQ #MaxFormatArgs-1,D0
- X LEA ArgStream(GP),A0
- XInitArgStreamLongs:
- X MOVE.L LineBufPtr,(A0)+
- X DBRA D0,InitArgStreamLongs
- X
- X
- X; ** This is an intelligent ReadLine routine.
- X
- X MOVEQ #0,ReadBytesLeft
- X
- X; Reinitialize the line buffer. (First part of dual buffer space)
- X
- XDoForEachLine:
- X LEA ReadError(PC),ErrorStrPtr
- X MOVE.L LineBufPtr,LineEndPtr
- X MOVE.L #MaxLineSize,LineBufLeft
- X
- X; Extract lines from the readbuffer into the line buffer.
- X
- X BRA.S ExtractEntry
- XCopyLineBytes:
- X MOVE.L ByteFetch,A0
- X ADDQ.L #1,ByteFetch
- X SUBQ.L #1,ReadBytesLeft
- X MOVE.B (A0),D0
- X CMP.B #10,D0
- X BEQ.S GotLine
- X MOVE.B D0,(LineEndPtr)+
- X SUBQ.L #1,LineBufLeft
- X BEQ.S GotLine
- XExtractEntry:
- X TST.L ReadBytesLeft
- X BNE CopyLineBytes
- X
- X; Refill the read buffer.
- X
- X MOVE.L StdIn(GP),D1
- X MOVE.L LineBufPtr,D2
- X MOVE.L #MaxLineSize,D3
- X ADD.L D3,D2
- X ADDQ.L #4,D2
- X CALL Read
- X TST.L D0
- X BMI.S ErrorExit
- X BNE.S NotYetDone
- X CMP.L LineBufPtr,LineEndPtr
- X BEQ.S Exit
- XNotYetDone:
- X MOVE.L D2,ByteFetch
- X MOVE.L D0,ReadBytesLeft
- X BNE CopyLineBytes
- X
- X; Null terminate the line.
- X
- XGotLine:
- X CLR.B (LineEndPtr)
- X
- X; Format things, terminate with a LF, and write the format buffer
- X
- X BSR.S VanillaDoFmt
- X MOVE.L FormatBufPtr(GP),A0
- X MOVE.B #10,-1(A0,D0.L)
- X
- X LEA WriteError(PC),ErrorStrPtr
- X MOVE.L StdOut(GP),D1
- X MOVE.L A0,D2
- X MOVE.L D0,D3
- X BEQ.S WriteDone
- X CALL Write
- X CMP.L D0,D3
- X BNE.S ErrorExit
- XWriteDone:
- X
- X; Check if user hit ^C
- X
- X SUB.L A1,A1
- X CALL CheckAbort
- X MOVE.L A1,ErrorStrPtr
- X TST.L D0
- X BNE.S ErrorExit
- X BRA DoForEachLine
- X
- X; Done, cleanup
- X
- XExit:
- X CLR.W ReturnCode(GP)
- X SUB.L ErrorStrPtr,ErrorStrPtr
- XErrorExit:
- X
- X; Display error string, if any, and exit
- X
- X MOVE.L ErrorStrPtr,D0
- X BEQ.S NoErrorMsg
- X MOVE.L D0,A1
- X CALL Puts
- XNoErrorMsg:
- X RTS
- X
- X; Subroutines
- X
- X; This sub uses exec's RawDoFmt to do string formatting while clipping
- X; any surplus data to fit the buffer size. Arps format routines have
- X; no overflow checks, and since the user is not guaranteed to act
- X; sanely, clipping is essential.
- X; I : Assumes a valid format string and buffer
- X; O : The format buffer contain the formatted string.
- X; : D0.L = Size of formatted string.
- X
- XVanilla_Regs REG A2/A3/A6
- X
- XVanillaDoFmt:
- X MOVEM.L Vanilla_Regs,-(SP)
- X MOVE.L ArgArray(GP),A0
- X LEA ArgStream(GP),A1
- X LEA DoClippedBufferFill(PC),A2
- X LEA FormatClipInfo(GP),A3
- X MOVE.L FormatBufPtr(GP),(A3)
- X MOVE.L (A3),4(A3)
- X ADD.L #FormatBufSize,4(A3)
- X MOVE.L $4.W,A6 ; exec
- X CALL RawDoFmt
- X MOVE.L (A3),D0
- X SUB.L FormatBufPtr(GP),D0
- X MOVEM.L (SP)+,Vanilla_Regs
- X RTS
- X
- X; Assumes A0 is usable, not clear from autodocs whether this is true.
- X; (Default calling conventions and ROM code suggest it is)
- X
- XDoClippedBufferFill:
- X MOVE.L (A3)+,A0
- X CMP.L (A3),A0
- X BNE.S NotYetAtBufEnd
- X SUBQ.L #1,A0
- XNotYetAtBufEnd:
- X MOVE.B D0,(A0)+
- X MOVE.L A0,-(A3)
- X RTS
- X
- X; The string section
- X
- XTemplate:
- X DC.B 'FormatString/a',0
- XHelpMsg:
- X DC.B 'PForm - Pipe formatted lines.',10
- X DC.B 'Usage: PForm "prefix %[width.limit]s postfix"',0
- XOutOfMem:
- X DC.B 'Out of memory!',0
- XReadError:
- X DC.B 'Error while reading',0
- XWriteError:
- X DC.B 'Error while writing',0
- X CNOP 0,2
- X
- X END
- END_OF_FILE
- if test 4230 -ne `wc -c <'PForm/PForm.asm'`; then
- echo shar: \"'PForm/PForm.asm'\" unpacked with wrong size!
- fi
- # end of 'PForm/PForm.asm'
- fi
- if test -f 'PForm/PForm.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'PForm/PForm.man'\"
- else
- echo shar: Extracting \"'PForm/PForm.man'\" \(1442 characters\)
- sed "s/^X//" >'PForm/PForm.man' <<'END_OF_FILE'
- X
- XNAME
- X PForm - Pipe formatted lines.
- X
- X
- XSYNOPSIS
- X PForm "prefix %[flags][width.limit]s postfix"
- X
- X
- XREQUIREMENTS
- X The ARP library
- X
- X
- XDESCRIPTION
- X PForm reads lines from the standard input, formats them to your
- X specifications, and writes them to the standard output.
- X The formatting is done using exec's DoRawFmt. This is C like string
- X formatting. See programmer manuals for additional information.
- X What matters here is that PForm outputs its argument line string
- X for every input line, and it replaces every occurrence of %s in the
- X argument line string with the current input line.
- X The "width" argument specifies the fieldsize used when inserting the
- X input line into the string, and "limit" specifies the maximum number
- X of characters copied from the input line while inserting.
- X The only valid flag is "-" which specifies left justification.
- X You may use %s upto 20 times in a single format string.
- X To get a single "%" use "%%".
- X The main use for PForm lies in reformatting the output of commands.
- X
- X
- XEXAMPLES
- X Alias Kill Status \| Search STDIN [] NONUM \| PForm "Break%11.10s" \| Execute
- X This alias will break the process with the name you specify. You
- X no longer need to specify the process number.
- X
- X List [] NOHEAD QUICK | PForm "Rename %s %s.old" | Execute
- X Give commands wildcarding properties.
- X
- X
- XBUGS/LIMITATIONS
- X How to apply PForm to the output of a command depends on the specific
- X format of its output. You'd better experiment.
- END_OF_FILE
- if test 1442 -ne `wc -c <'PForm/PForm.man'`; then
- echo shar: \"'PForm/PForm.man'\" unpacked with wrong size!
- fi
- # end of 'PForm/PForm.man'
- fi
- if test -f 'PForm/PForm.uu' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'PForm/PForm.uu'\"
- else
- echo shar: Extracting \"'PForm/PForm.uu'\" \(969 characters\)
- sed "s/^X//" >'PForm/PForm.uu' <<'END_OF_FILE'
- Xbegin 644 PForm
- XM```#\P`````````!``````````````">```#Z0```)Y@"DK\```/H`````!.,
- XM5?^*(D]"6;O)9OH[?`!D__8K2/_\*T#_^"QX``1#^@!7<"=.KOW82H!F7D/Z=
- XM`#1.KOW82H!G("Q`3J[_Q"(`9PQ!^@`J)`AV&TZN_]`B3BQX``1.KOYB,"W_3
- XM]DB`3EU.=61O<RYL:6)R87)Y`'EO=2!N965D(&%R<"YL:6)R87)Y`"!6,SDK!
- XM"@`L0#M\`!3_]F$"8+@@;?_\("W_^$/Z`4=%[?_N1_H!,"2)3J[_!"A22H!GJ
- XM``#0:P``S$ZN_\HK0/^23J[_Q"M`_XY)^@%E(#P```7<<@!.KOYZ*T#_BF<`F
- XM`*0@/```!`1R`$ZN_GHL`&<``))P$T'M_YX@QE'(__QZ`$GZ`3PD1BX\```"K
- XM`&`4($12A%.%$!"P/``*9RX4P%.'9RA*A6;H(BW_DB0&)CP```(`U(-8@DZNF
- XM_]9*@&M$9@2UQF<X*`(J`&;$0A)A0"!M_XH1O``*"/])^@#X(BW_CB0()@!G)
- XM"$ZN_]"V@&84D\E.KO[R*$E*@&8(8(1";?_VF<P@#&<&(D!.KO\03G5(YP`R+
- XM(&W_[D/M_YY%^@`J1^W_EB:M_XHG4P`$!JL```7<``0L>``$3J[]]B`3D*W_O
- XMBDS?3`!.=2!;L=-F`E.($,`G"$YU1F]R;6%T4W1R:6YG+V$`4$9O<FT@+2!09
- XM:7!E(&9O<FUA='1E9"!L:6YE<RX*57-A9V4Z(%!&;W)M(")P<F5F:7@@)5MWQ
- XM:61T:"YL:6UI=%US('!O<W1F:7@B`$]U="!O9B!M96UO<GDA`$5R<F]R('=HE
- XF:6QE(')E861I;F<`17)R;W(@=VAI;&4@=W)I=&EN9P```````_)R"
- X``
- Xend
- Xsize 668
- END_OF_FILE
- if test 969 -ne `wc -c <'PForm/PForm.uu'`; then
- echo shar: \"'PForm/PForm.uu'\" unpacked with wrong size!
- fi
- # end of 'PForm/PForm.uu'
- fi
- if test -f 'ReadMe' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ReadMe'\"
- else
- echo shar: Extracting \"'ReadMe'\" \(1939 characters\)
- sed "s/^X//" >'ReadMe' <<'END_OF_FILE'
- X
- X Tiny Tools V1.0
- X ================
- X
- X
- XThis archive contains a set of tools/commands. All are tiny and can be made
- Xresident. Use the "ExecMe" batchfile to fix the pure flags. Most tools
- Xrequire the ARP library.
- X
- X
- XHere's a list;
- X
- XCheckList - Check for the presence of an item in a system list.
- XClip - Pipe through clipped lines.
- XFilTex - Filter out non-text bytes.
- XNoReq - Disable system requesters (toggle).
- XPForm - Pipe through formatted lines.
- XTee - Split pipe stream.
- XWBTF - WorkBench to front.
- X
- X
- XEach tool's directory contains an executable, manual and assembly source.
- X
- XAll executables contain a "resident program tag" with a stack size setting
- Xthat overrides your shell's default setting, assuming it uses ARP for
- Xlaunching programs. This helps you conserve memory. None of the tools
- Xrequire more than 4000 bytes stack, so if you don't use an ARP driven shell
- Xyou'll still be safe.
- X
- XMost of these tools are building blocks for making aliases or batchfiles.
- XUse your imagination and you'll surely find some novel ways in which to
- Xapply them to enhance your system. Don't limit yourself to the scope of
- Xthe examples.
- XSome examples given in the manuals assume an ARP/ASH/PIP: environment. If
- Xyour shell has no in-line piping facility, you'll have to use redirection
- Xin order to make use of Clip, PForm and Tee.
- X
- XThe source code requires the init.i file in the include directory. No other
- Xinclude files are needed in order to assemble. I've written these tools in
- Xassembly because I love the snappy way in which my ARP system operates by
- Xvirtue of a lot of tools being resident, and I don't want to waste a lot of
- Xmemory.
- X
- XYou may apply, modify or distribute the source and tools as you see fit.
- XPreferably keep this archive in its original state though.
- X
- XDirect ideas for new tools or any bug reports to:
- X
- XUUCP: hp4nl!neabbs!ajbrouw
- X
- Xor
- X
- XAlbert-Jan Brouwer
- XSt-Eustatiusstr. 2
- X2612 HA Delft
- XThe Netherlands
- X
- XEnjoy
- END_OF_FILE
- if test 1939 -ne `wc -c <'ReadMe'`; then
- echo shar: \"'ReadMe'\" unpacked with wrong size!
- fi
- # end of 'ReadMe'
- fi
- if test ! -d 'Tee' ; then
- echo shar: Creating directory \"'Tee'\"
- mkdir 'Tee'
- fi
- if test -f 'Tee/Tee.asm' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Tee/Tee.asm'\"
- else
- echo shar: Extracting \"'Tee/Tee.asm'\" \(3530 characters\)
- sed "s/^X//" >'Tee/Tee.asm' <<'END_OF_FILE'
- X; Tee, split stdinput to stdoutput and multiple file streams.
- X
- X INCLUDE "/include/init.i"
- X
- X; Local Equs
- X
- XBufSize EQU 512
- XHandles EQU BufSize
- X
- X; Variable storage
- X
- X STRUCT ArgArray,(2+1)*4 ; +1 'cause I'm parnoid
- X SIZE
- X
- X; Regs
- X
- XAppendBool EQUR D4
- XStdInput EQUR D5
- XAllocStruct EQUR D6
- XActualLength EQUR D7
- X
- XFileNamePtrPtr EQUR A2
- XHandlePtr EQUR A3
- XErrorStrPtr EQUR A4
- X
- X; Start
- X
- X STACK 4000
- X INIT
- X
- X; Let ARP interpret the commandline
- X
- X MOVE.L ComLineBase(GP),A0
- X MOVE.L ComLineSize(GP),D0
- X LEA HelpMsg(PC),A1
- X LEA ArgArray(GP),A2
- X LEA Template(PC),A3
- X MOVE.L A1,(A2)
- X CALL GADS
- X TST.L D0
- X BEQ.S UnusableArgs
- X BPL.S ArgsMightBeOK
- XUnusableArgs:
- X MOVE.L (A2),ErrorStrPtr
- X BRA ErrorExit
- XArgsMightBeOK:
- X
- X; Fetch the -a switch and check if at least one file present.
- X
- X MOVE.L 4(A2),AppendBool
- X BEQ.S ArgsOK
- X LEA HelpMsg(PC),ErrorStrPtr
- X MOVEQ #1,D1
- X CMP.L D0,D1
- X BEQ ErrorExit
- XArgsOK:
- X
- X; Alloc tracked mem for the read write buf and the handles.
- X
- X LEA OutOfMem(PC),ErrorStrPtr
- X ADDQ.L #1+1,D0 ; Make space for StdOut + null termination
- X LSL.L #2,D0 ; in the file handles longword array.
- X ADD.L #BufSize,D0 ; Buffer and Handles use same mem allocation
- X MOVEQ #0,D1
- X CALL ArpAllocMem
- X MOVE.L D0,AllocStruct ; Data reg, so Z gets set
- X BEQ ErrorExit
- X
- X; Initialize the handle and filename longword array pointers
- X
- X MOVE.L ArgArray(GP),FileNamePtrPtr
- X MOVE.L AllocStruct,A0
- X LEA Handles(A0),HandlePtr
- X
- X; Open the standard input and output
- X
- X CALL Input
- X MOVE.L D0,StdInput
- X CALL Output
- X MOVE.L D0,(HandlePtr)+
- X
- X
- X;----- The open the files, and seek to end loop
- X
- X LEA OpenError(PC),ErrorStrPtr
- XOpenNextFile:
- X TST.L (FileNamePtrPtr)
- X BEQ.S AllFilesOpened
- X
- X; If Appending, try to open (tracked) the file as an old file
- X
- X TST.L AppendBool
- X BEQ.S NoAppendingRequested
- X MOVE.L (FileNamePtrPtr),D1
- X MOVE.L #MODE_OLDFILE,D2
- X CALL ArpOpen
- X MOVE.L D0,(HandlePtr)
- X BEQ.S TryToOpenNewFile
- X
- X; Seek to the end
- X
- X MOVE.L D0,D1
- X MOVEQ #0,D2
- X MOVE.L #OFFSET_END,D3
- X CALL Seek
- X ADDQ.L #1,D0
- X BEQ ErrorExit
- X BRA.S IncrementAndLoop
- XNoAppendingRequested:
- X
- X; Open files (tracked) as new
- X
- XTryToOpenNewFile:
- X MOVE.L (FileNamePtrPtr),D1
- X MOVE.L #MODE_NEWFILE,D2
- X CALL ArpOpen
- X MOVE.L D0,(HandlePtr)
- X BEQ ErrorExit
- X
- X; Update pointers and loop back
- X
- XIncrementAndLoop:
- X ADDQ.L #4,FileNamePtrPtr
- X ADDQ.L #4,HandlePtr
- X BRA OpenNextFile
- XAllFilesOpened:
- X CLR.L (HandlePtr) ; Null termination
- X
- X
- X;----- The single input multi output copy loop, check for ^C & initize
- X
- XDoNextRdWrChunk:
- X SUB.L A1,A1
- X CALL CheckAbort
- X MOVE.L A1,ErrorStrPtr
- X TST.L D0
- X BNE.S ErrorExit
- X
- X LEA WriteError(PC),ErrorStrPtr
- X MOVE.L AllocStruct,A0
- X LEA Handles(A0),HandlePtr ; Reset to start of array
- X
- X; Read from the standard input until EOF or error
- X
- X MOVE.L StdInput,D1
- X MOVE.L AllocStruct,D2
- X MOVE.L #BufSize,D3
- X CALL Read
- X MOVE.L D0,ActualLength
- X BEQ.S Exit
- X BMI.S ErrorExit
- X
- X; Do the multiwrite, and loop back
- X
- XDoNextWrite:
- X MOVE.L (HandlePtr)+,D1
- X BEQ DoNextRdWrChunk
- X MOVE.L AllocStruct,D2
- X MOVE.L ActualLength,D3
- X CALL Write
- X CMP.L D0,D3
- X BNE.S ErrorExit
- X BRA DoNextWrite
- X
- X
- X; Done, cleanup
- X
- XExit:
- X CLR.W ReturnCode(GP)
- X SUB.L ErrorStrPtr,ErrorStrPtr
- XErrorExit:
- X
- X; Display error string, if any, and exit
- X
- X MOVE.L ErrorStrPtr,D0
- X BEQ.S NoErrorMsg
- X MOVE.L D0,A1
- X CALL Puts
- XNoErrorMsg:
- X RTS
- X
- X; The string section
- X
- XTemplate:
- X DC.B 'Files/...,-a=APPEND/s',0
- XHelpMsg:
- X DC.B 'Tee - pipe fitting.',10
- X DC.B 'Usage: Tee [-a] <File> [...]',0
- XOutOfMem:
- X DC.B 'Out of memory!',0
- XOpenError:
- X DC.B 'Tee-file could not be opened',10
- XWriteError:
- X DC.B 'Error while writing to tee-file',0
- X CNOP 0,2
- X
- X END
- END_OF_FILE
- if test 3530 -ne `wc -c <'Tee/Tee.asm'`; then
- echo shar: \"'Tee/Tee.asm'\" unpacked with wrong size!
- fi
- # end of 'Tee/Tee.asm'
- fi
- if test -f 'Tee/Tee.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Tee/Tee.man'\"
- else
- echo shar: Extracting \"'Tee/Tee.man'\" \(1374 characters\)
- sed "s/^X//" >'Tee/Tee.man' <<'END_OF_FILE'
- X
- XNAME
- X Tee - pipe fitting
- X
- X
- XSYNOPSIS
- X Tee [-a | APPEND] <File> [...]
- X
- X
- XREQUIREMENTS
- X The ARP library
- X
- X
- XDESCRIPTION
- X Tee copies the standard input to the standard output while making
- X copies of it into one or more files. The -a or APPEND switch makes
- X Tee append to old files instead of creating new files. If a target
- X file does not exist, and -a has been selected, it will be created.
- X
- X
- XEXAMPLES
- X prompt> Tee T:keys | QueryingTool
- X prompt> QueryingTool <T:keys | Tee T:log
- X This saves keystrokes destined for a CLI tool to a file, and
- X reuses them whilst making a reference copy of the output.
- X
- X
- XBUGS/LIMITATIONS
- X -Use the end-of-file control key specific to your shell to terminate
- X if you run Tee as the first part of your pipe-command line.
- X -Tee was modelled after one of the Unix-alike utilities distributed
- X in a uusenet posting by David Gay. Tiny-Tee's functionality differs
- X from that version in 3 ways:
- X 1. The -a switch can be substituted by an equivalent switch, namely
- X 'APPEND'.
- X 2. The ARP template needs switches to be specified after multiargs,
- X still you may place the -a switch anywhere in the command line,
- X thus it is up to you to preserve the Unix syntax (-a in front).
- X 3. David's Tee version does not seem to want to process non-ascii
- X byte streams (this might be as intended). Tiny-Tee copies every
- X byte you feed into it.
- END_OF_FILE
- if test 1374 -ne `wc -c <'Tee/Tee.man'`; then
- echo shar: \"'Tee/Tee.man'\" unpacked with wrong size!
- fi
- # end of 'Tee/Tee.man'
- fi
- if test -f 'Tee/Tee.uu' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Tee/Tee.uu'\"
- else
- echo shar: Extracting \"'Tee/Tee.uu'\" \(872 characters\)
- sed "s/^X//" >'Tee/Tee.uu' <<'END_OF_FILE'
- Xbegin 644 Tee
- XM```#\P`````````!``````````````"-```#Z0```(U@"DK\```/H`````!.J
- XM5?_J(D]"6;O)9OH[?`!D__8K2/_\*T#_^"QX``1#^@!7<"=.KOW82H!F7D/Z]
- XM`#1.KOW82H!G("Q`3J[_Q"(`9PQ!^@`J)`AV&TZN_]`B3BQX``1.KOYB,"W_3
- XM]DB`3EU.=61O<RYL:6)R87)Y`'EO=2!N965D(&%R<"YL:6)R87)Y`"!6,SDK!
- XM"@`L0#M\`!3_]F$"8+@@;?_\("W_^$/Z`0I%[?_J1_H`["2)3J[_!$J`9P)J6
- XM!BA28```SB@J``1G#$GZ`.9R`;*`9P``O$GZ`0M4@.6(!H````(`<@!.KOYZF
- XM+`!G``"B)&W_ZB!&1^@"`$ZN_\HJ`$ZN_\0FP$GZ`.I*DF<^2H1G(B(2)#P`S
- XM``/M3J[^=":`9Q(B`'0`=@%.KO^^4H!G``!@8!(B$B0\```#[DZN_G0F@&<`.
- XM`$Q8BEB+8+Y"DY/)3J[^\BA)2H!F-DGZ`+,@1D?H`@`B!20&)CP```(`3J[_@
- XMUBX`9Q1K&"(;9](D!B8'3J[_T+:`9@A@[D)M__:9S"`,9P8B0$ZN_Q!.=49I-
- XM;&5S+RXN+BPM83U!4%!%3D0O<P!4964@+2!P:7!E(&9I='1I;F<N"E5S86=E)
- XM.B!4964@6RUA72`\1FEL93X@6RXN+ET`3W5T(&]F(&UE;6]R>2$`5&5E+69I[
- XM;&4@8V]U;&0@;F]T(&)E(&]P96YE9`I%<G)O<B!W:&EL92!W<FET:6YG('1OO
- X/('1E92UF:6QE``````/R@
- X``
- Xend
- Xsize 600
- END_OF_FILE
- if test 872 -ne `wc -c <'Tee/Tee.uu'`; then
- echo shar: \"'Tee/Tee.uu'\" unpacked with wrong size!
- fi
- # end of 'Tee/Tee.uu'
- fi
- if test ! -d 'WBTF' ; then
- echo shar: Creating directory \"'WBTF'\"
- mkdir 'WBTF'
- fi
- if test -f 'WBTF/WBTF.asm' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'WBTF/WBTF.asm'\"
- else
- echo shar: Extracting \"'WBTF/WBTF.asm'\" \(799 characters\)
- sed "s/^X//" >'WBTF/WBTF.asm' <<'END_OF_FILE'
- X
- X; A few equs and equrs.
- X
- XKickVerNum EQU 31 ; >= Kick 1.1
- XFatal EQU 20
- XWarn EQU 5
- XOK EQU 0
- X
- XRETURN EQUR D2
- X
- X INCLUDE "/include/init.i"
- X
- X; I suppose this is more than sufficient stack for intuition.
- X
- X STACK 2000
- X
- X; Open the intuition library
- X
- X MOVEQ #Fatal,RETURN
- X MOVEQ #KickVerNum,D0
- X LEA IntuitionName(PC),A1
- X MOVE.L $4.W,A6
- X CALL OpenLibrary
- X TST.L D0
- X BEQ.S FatalExit
- X
- X; Request that the workbench be sent to front
- X
- X MOVEQ #Warn,RETURN
- X MOVE.L D0,A6
- X CALL WBenchToFront
- X TST.B D0
- X BNE.S Exit
- X
- X; Workbench closed, ask for the workbench to be opened
- X
- X CALL OpenWorkBench
- X TST.L D0
- X BEQ.S WarnExit
- X
- X; Cleanup
- X
- XExit:
- X MOVEQ #OK,RETURN
- XWarnExit:
- X MOVE.L A6,A1
- X MOVE.L $4.W,A6
- X CALL CloseLibrary
- XFatalExit:
- X MOVE.L RETURN,D0
- X RTS
- X
- X; Strings
- X
- XIntuitionName:
- X DC.B 'intuition.library',0
- X CNOP 0,2
- X
- X END
- END_OF_FILE
- if test 799 -ne `wc -c <'WBTF/WBTF.asm'`; then
- echo shar: \"'WBTF/WBTF.asm'\" unpacked with wrong size!
- fi
- # end of 'WBTF/WBTF.asm'
- fi
- if test -f 'WBTF/WBTF.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'WBTF/WBTF.man'\"
- else
- echo shar: Extracting \"'WBTF/WBTF.man'\" \(735 characters\)
- sed "s/^X//" >'WBTF/WBTF.man' <<'END_OF_FILE'
- X
- XNAME
- X WBTF - switch Workbench to front
- X
- X
- XSYNOPSIS
- X WBTF
- X
- X
- XREQUIREMENTS
- X none
- X
- X
- XDESCRIPTION
- X WBTF tries to switch the WorkBench screen to the front. If it
- X fails, because the WBscreen has been closed by some program,
- X it will try to reopen the WorkBench.
- X WBTF returns returncode 0 when it succeeds, and returncode
- X 5 when the WorkBench could not be reopened.
- X
- X
- XEXAMPLES
- X Place WBTF in your 'Shell-Startup' script. If you use a hot-key
- X utility like DMouse, the WorkBench screen should pop upfront
- X whenever you hot-key-open a shell.
- X
- X
- XBUGS/LIMITATIONS
- X The WorkBench reopen feature is not very useful in the context
- X given by the example; For the Shell-Startup to execute, a shell
- X window, and therefore the WBscreen, has to be open.
- END_OF_FILE
- if test 735 -ne `wc -c <'WBTF/WBTF.man'`; then
- echo shar: \"'WBTF/WBTF.man'\" unpacked with wrong size!
- fi
- # end of 'WBTF/WBTF.man'
- fi
- if test -f 'WBTF/WBTF.uu' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'WBTF/WBTF.uu'\"
- else
- echo shar: Extracting \"'WBTF/WBTF.uu'\" \(208 characters\)
- sed "s/^X//" >'WBTF/WBTF.uu' <<'END_OF_FILE'
- Xbegin 644 WBTF
- XM```#\P`````````!```````````````6```#Z0```!9@"DK\```'T`````!T*
- XM%'`?0_H`,BQX``1.KOW82H!G('0%+$!.KOZJ2@!F"$ZN_RY*@&<"=``B3BQX!
- XB``1.KOYB(`).=6EN='5I=&EO;BYL:6)R87)Y```````#\BY*X
- X``
- Xend
- Xsize 124
- END_OF_FILE
- if test 208 -ne `wc -c <'WBTF/WBTF.uu'`; then
- echo shar: \"'WBTF/WBTF.uu'\" unpacked with wrong size!
- fi
- # end of 'WBTF/WBTF.uu'
- fi
- echo shar: End of archive 1 \(of 1\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have the archive.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- --
- Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
- Mail comments to the moderator at <amiga-request@uunet.uu.net>.
- Post requests for sources, and general discussion to comp.sys.amiga.
-